package 双指针;

public class _004 {
   // 11. 盛最多水的容器

       public int maxArea(int[] height) {
           int left=0;
           int right=height.length-1;
           int max=0;
           int y=0;
           int shui=0;
           while(left!=right){
               if(height[right]>=height[left]){
                   y=height[left];
               }else{
                   y=height[right];
               }
               int x=right-left;
               shui=x*y;
               if(max<=shui){
                   max=shui;
               }
               if(height[right]>=height[left]){
                   left++;
               }else{
                   right--;
               }
           }
           return max;

   }
}
